#define _CRT_SECURE_NO_WARNINGS 1
#include<vector>
#include<iostream>
using namespace std;
class Solution {
public:
    int searchInsert(vector<int>& nums, int target) {
        int left = 0;
        int right = nums.size()-1;
        int Mid = right / 2;
        while (left <= right) {
            if (target == nums[Mid]) break;
            else if (target > nums[Mid]) left = Mid + 1;
            else right = Mid - 1;
            Mid = (right + left + 1) / 2;
        }
        return Mid;
    }
};
int main()
{
    Solution s;
    vector<int> nums = { 1,3,5,6 };
    int target = 7;
    s.searchInsert(nums, target);
    return 0;
}